function UI_RadioButton ( text, x, y, w, h, parent )
	local ele = createElement ( "UI_RadioButton" )
	setElementParent ( ele, parent or getResourceDynamicElementRoot ( sourceResource or getThisResource ( ) ) )

	setElementData ( ele, "UI_Text", text )
	setElementData ( ele, "UI_X", x )
	setElementData ( ele, "UI_Y", y )
	setElementData ( ele, "UI_Width", w )
	setElementData ( ele, "UI_Height", h )
	setElementData ( ele, "UI_Alpha", 255 )
	setElementData ( ele, "UI_Selected", selected )
	setElementData ( ele, "UI_RGB", { ["Red"] = 255, ["Green"] = 255, ["Blue"] = 255 } )
	setElementData ( ele, "UI_Font", "default-bold" )
	setElementData ( ele, "UI_FontSize", 1 )
	setElementData ( ele, "UI_ColorCoded", false )
	setElementData ( ele, "UI_Theme", UI_ThemeDefault )
	setElementData ( ele, "UI_EventMouseState", false )
	
	setElementData ( ele, "UI_RenderTarget", dxCreateRenderTarget ( w > 1 and w or 1, h > 1 and h or 1, true ) )

	if ( parent ) then
		if ( not UI_RenderParent[parent] ) then UI_RenderParent[parent] = {} end
		table.insert ( UI_RenderParent[parent], ele )
	else
		table.insert ( UI_Render, ele )
	end
	
	return ele
end

function UI_RadioButtonGetSelected ( ele )
	return getElementData ( ele, "UI_Selected" )
end

function UI_RadioButtonSetSelected ( ele, toggle )
	if ( getElementType ( ele ) == "UI_RadioButton" ) then
		if ( toggle ) then
			local Parent = getElementParent ( ele )
			if ( Parent ) then
				for _, v in ipairs ( UI_RenderParent[Parent] ) do
					if ( getElementType ( v ) == "UI_RadioButton" and getElementParent ( v ) == Parent ) then
						setElementData ( v, "UI_Selected", false )
					end
				end
			end
		end
		if ( setElementData ( ele, "UI_Selected", toggle ) ) then
			return true
		end
	end
	return false
end

function UI_ImageGeneratorRadioButton ( ele )
	local Text = getElementData ( ele, "UI_Text" ) or " "
	local X = getElementData ( ele, "UI_X" ) or 0
	local Y = getElementData ( ele, "UI_Y" ) or 0
	local Width = getElementData ( ele, "UI_Width" ) or 0
	local Height = getElementData ( ele, "UI_Height" ) or 0
	local Selected = getElementData ( ele, "UI_Selected" )
	local RGB = getElementData ( ele, "UI_RGB" ) or { ["Red"] = 255, ["Green"] = 255, ["Blue"] = 255 }
	local Font = getElementData ( ele, "UI_Font" ) or "default-bold"
	local FontSize = getElementData ( ele, "UI_FontSize" ) or 1
	if ( isElement ( Font ) and getElementType ( Font ) == "UI_Font" ) then
		Font = getElementData ( Font, "UI_Font" )
	end
	local Colored = getElementData ( ele, "UI_ColorCoded" ) or false
	local MouseState = getElementData ( ele, "UI_EventMouseState" ) or false
	local RenderTarget = getElementData ( ele, "UI_RenderTarget" )
	local Theme = getElementData ( ele, "UI_Theme" ) or UI_ThemeDefault
	local ThemeRadioButton = "RadioButtonHover"

	if ( MouseState ) then
		ThemeRadioButton = "RadioButtonHover"
		if ( Selected ) then
			ThemeRadioButton = "RadioButtonMarkHover"
		end
	else
		ThemeRadioButton = "RadioButtonNormal"
		if ( Selected ) then
			ThemeRadioButton = "RadioButtonMark"
		end
	end

	dxSetRenderTarget ( RenderTarget, true )
	ThemeXPos, ThemeYPos, ThemeWidth, ThemeHeight, ThemeImage = UI_ThemeGetAll ( ThemeRadioButton, Theme )
	dxDrawImageSection ( 0, Height / 2 - ( ThemeHeight / 2 ), ThemeWidth, ThemeHeight, ThemeXPos, ThemeYPos, ThemeWidth, ThemeHeight, ThemeImage )
	dxDrawText ( Text, ThemeWidth + 5, Height / 2, tocolor ( RGB["Red"], RGB["Green"], RGB["Blue"], 255 ), FontSize, Font, "left", "center", _, Colored )
	dxSetRenderTarget ( )

	return RenderTarget or nil
end